package com.kit.data.kitopeso.view;


import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.AppCompatTextView;

import com.kit.data.kitopeso.net.PU;
import com.kit.data.kitopeso.tools.LogUtil;


public class KitoTextView extends AppCompatTextView {

    private long clickStartTime = 0;

    private long clickEndTime = 0;

    private String type;

    private String headStr = "";

    public KitoTextView(@NonNull Context context) {
        super(context);
    }

    public KitoTextView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public KitoTextView(@NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public long getClickStartTime() {
        return clickStartTime;
    }

    public void setClickStartTime(long clickStartTime) {
        this.clickStartTime = clickStartTime;
    }

    public long getClickEndTime() {
        return clickEndTime;
    }

    public void setClickEndTime(long clickEndTime) {
        this.clickEndTime = clickEndTime;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getHeadStr() {
        return headStr;
    }

    public void setHeadStr(String headStr) {
        this.headStr = headStr;
    }

    public void sendEvent(String content) {
        long time = clickEndTime - clickStartTime;
        String remark = content + "$$" + time;
        LogUtil.e("me", type + "--sendEvent--" + remark);
        if (!TextUtils.isEmpty(type)) {
            PU.userBuriedPoint(type, remark);
        }
    }

}
